package org.example.reactive.demo1.handler;

import org.example.reactive.demo1.exception.BaseException;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

/**
 * @author Gong.Yang
 * 用来制造异常
 */
@Component
public class CreateErrorHandler {
    public Mono<ServerResponse> baseError(ServerRequest request) {
        throw new BaseException("产生了业务异常！！！");
    }

    public Mono<ServerResponse> systemError(ServerRequest request) {
        throw new NullPointerException("空指针异常");
    }
}
